#include "HeadFiles.h"

BaseWindow* WindowControl::s_screen = nullptr;
WindowControl* WindowControl::s_instance = nullptr;

WindowControl::WindowControl()
{
	//s_screen = new FieldWindow();
	//s_screen = new VillageWindow();
	s_screen = new StartWindow();
}

WindowControl::~WindowControl()
{
	if (s_screen)
		delete s_screen;
}

void WindowControl::Show()
{
	if(s_screen == nullptr)
		s_screen = new StartWindow();
	s_screen->Show();
}

void WindowControl::Update()
{
	s_screen->Update();
}

void WindowControl::Init()
{
	s_screen->Init();
}

void WindowControl::ChangeWindow(WindowType type)
{
	if (s_screen)
	{
		delete s_screen;
		s_screen = Factory::Instance()->FCreateWindow(type);
	}
}

WindowControl * WindowControl::Instance()
{
	if (s_instance == nullptr)
	{
		s_instance = new WindowControl;
	}
	return s_instance;
}
